A good answer might be:

Any extra lines in the file are simply ignored by the program.


Blank Lines

Here is a situation that is often very frustrating: The input file starts with a line that contains only the end of line character. (This can be created in Notepad by hitting "enter" when the cursor is on the first line.) For example, the input file might look like this:

This is line two of the file.
The last line of the file.

When this file is redirected to the program the output looks like this:

C:\users\default\JavaLessons>java Echo < input.txt

Enter your input:
You typed:

C:\users\default\JavaLessons>

The first line (containing only the end of line character) is all that is read in, and all that is written out. It looks as though the program is not working, but in fact it is doing exactly what it was written to do. When you create data files with Notepad be careful of this situation.

QUESTION 5:

To read 5 lines from a file, how many times must the readLine() method be executed?